﻿Imports System.Data.SqlClient
Imports Microsoft.Reporting.WinForms
Public Class FormReport_Customer
    Private Sub ReportViewerCus_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReportViewerCus.Load
       
    End Sub

    Private Sub FormReport_Customer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim cn As New SqlConnection()
        cn.ConnectionString = "server=.\SOPHORN;uid=sa;pwd=123;database=AppSaleDb;"
        cn.Open()

        Dim cmd As New SqlCommand()
        cmd.Connection = cn
        cmd.CommandText = "SELECT * FROM tbl_Customer"
        Dim reader As SqlDataReader = cmd.ExecuteReader()

        Me.ReportViewerCus.LocalReport.DataSources.Add(New ReportDataSource("DataSetReport_Cus", reader))
        Me.ReportViewerCus.LocalReport.ReportEmbeddedResource = "StockSale.Report1.rdlc"
        Me.ReportViewerCus.ZoomMode = ZoomMode.FullPage
        Me.ReportViewerCus.RefreshReport()
    End Sub
End Class